<!DOCTYPE html>
<html>
	<head>
		<meta charset="UTF-8">
		<script src="jquery.js" type="text/javascript">
		</script>
		<title>ajax-get</title>
	</head>
	<body>
		<!--AJAX:在不更新页面的条件下更新页面数据-->
		<form action="login.html"  enctype="application/x-www-form-urlencoded" >
			<input type="text" name="username" placeholder="请输入用户名" /><br />
			<input type="password" name="password" placeholder="请输入密码" /><br /><br />
			<input type="submit" value="登录"/>
		</form>
		<script>
			$('form').submit(function(ev){
				ev.preventDefault();
				console.log('已阻止')
				//获取表单数据,自动转化为字符串序列化对
				var data = $(this).serialize();
				$.get({
					url:'index.html',
					data:data,
					success:function(resData){
						//内部参数:服务端返回的响应数据
					}
				})
			})
		</script>
	</body>
</html>
